#include "outputsetitem.h"
#include "ui_outputsetitem.h"
#include "outsettingdlg.h"

//const char* OutputSetItem::showName[]=
//{
//    [NONE] = "无",
//    [START] = "启动运行",
//    [HI] = "过量动作",
//    [OK] = "合格动作",
//    [HI] = "轻量动作",
//    [R1] = "区间1",[R2] = "区间2",[R3] = "区间3",[R4] = "区间4",[R5] = "区间5",[R6] = "区间6",[R7] = "区间7",[R8] = "区间8",
//    [R9] = "区间9",[R10] = "区间10",[R11] = "区间11",[R12] = "区间12",[R13] = "区间13",[R14] = "区间14",[R15] = "区间15",[END] = nullptr
//};
OutputSetItem::OutputSetItem(Output* output,QWidget *parent) :
    QWidget(parent),mOutput(output),
    ui(new Ui::OutputSetItem)
{
    ui->setupUi(this);
    ui->btn_set->setText(QString::number(output->getNo()).prepend("Y"));
    setOptShow();
}

OutputSetItem::~OutputSetItem()
{
    delete ui;
}

void OutputSetItem::setOptShow()
{
    ui->label->setText(mOutput->getOptName());
}

void OutputSetItem::on_btn_set_clicked()
{
    OutSettingDlg* dlg = new OutSettingDlg(mOutput);
    connect(dlg,SIGNAL(accepted()),this,SLOT(setOptShow()));
    dlg->exec();
}
